package system

import (
	"context"
	"gf-assistant/internal/common/factory"
	"gf-assistant/internal/system/parameter"
)

// User 账号控制器类
var User = UserController{
	service: "system.UserService",
}

type UserController struct {
	service string
}

func (u *UserController) GetUser(ctx context.Context, req *parameter.GetUserReq) (res *parameter.GetUserRes, err error) {
	return GetUserService().GetUser(ctx, req), nil
}

func (u *UserController) ListUser(ctx context.Context, req *parameter.ListUserReq) (res *parameter.ListUserRes, err error) {
	return GetUserService().ListUser(ctx, req), nil
}

func (u *UserController) SaveUser(ctx context.Context, req *parameter.SaveUserReq) (res *parameter.SaveUserRes, err error) {
	return GetUserService().SaveUser(ctx, req), nil
}
func (u *UserController) DeleteUser(ctx context.Context, req *parameter.DeleteUserReq) (res *parameter.DeleteUserRes, err error) {
	return GetUserService().DeleteUser(ctx, req), nil
}
func (u *UserController) GetUserPermission(ctx context.Context, req *parameter.GetUserPermissionReq) (res *parameter.GetUserPermissionRes, err error) {
	return GetUserService().GetUserPermission(ctx, req), nil
}
func (u *UserController) AuthUserRole(ctx context.Context, req *parameter.AuthUserRoleReq) (res *parameter.AuthUserRoleRes, err error) {
	return GetUserService().AuthUserRole(ctx, req), nil
}
func GetUserService() *UserService {
	return factory.Get(User.service).(*UserService)
}
